{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "0b45ac2a",
   "metadata": {},
   "source": [
    "# 数据准备"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "218d9236",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "a54b8096",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaopeng Yang</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/5</td>\n",
       "      <td>0:04:34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changqiang You</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.5</td>\n",
       "      <td>70.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/4</td>\n",
       "      <td>0:04:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Sun</td>\n",
       "      <td>Male</td>\n",
       "      <td>188.9</td>\n",
       "      <td>89.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/12</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>41.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/3</td>\n",
       "      <td>0:04:08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Gaojuan You</td>\n",
       "      <td>Male</td>\n",
       "      <td>174.0</td>\n",
       "      <td>74.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>195</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/17</td>\n",
       "      <td>0:04:31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Li Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.9</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/22</td>\n",
       "      <td>0:04:03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengqiang Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>45.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/5</td>\n",
       "      <td>0:04:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengmei Shen</td>\n",
       "      <td>Male</td>\n",
       "      <td>175.3</td>\n",
       "      <td>71.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/7</td>\n",
       "      <td>0:04:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Chunpeng Lv</td>\n",
       "      <td>Male</td>\n",
       "      <td>155.7</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:05</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>200 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                            School      Grade            Name  Gender  Height  \\\n",
       "0    Shanghai Jiao Tong University   Freshman    Gaopeng Yang  Female   158.9   \n",
       "1                Peking University   Freshman  Changqiang You    Male   166.5   \n",
       "2    Shanghai Jiao Tong University     Senior         Mei Sun    Male   188.9   \n",
       "3                 Fudan University  Sophomore    Xiaojuan Sun  Female     NaN   \n",
       "4                 Fudan University  Sophomore     Gaojuan You    Male   174.0   \n",
       "..                             ...        ...             ...     ...     ...   \n",
       "195               Fudan University     Junior    Xiaojuan Sun  Female   153.9   \n",
       "196            Tsinghua University     Senior         Li Zhao  Female   160.9   \n",
       "197  Shanghai Jiao Tong University     Senior  Chengqiang Chu  Female   153.9   \n",
       "198  Shanghai Jiao Tong University     Senior   Chengmei Shen    Male   175.3   \n",
       "199            Tsinghua University  Sophomore     Chunpeng Lv    Male   155.7   \n",
       "\n",
       "     Weight Transfer  Test_Number   Test_Date Time_Record  \n",
       "0      46.0        N            1   2019/10/5     0:04:34  \n",
       "1      70.0        N            1    2019/9/4     0:04:20  \n",
       "2      89.0        N            2   2019/9/12     0:05:22  \n",
       "3      41.0        N            2    2020/1/3     0:04:08  \n",
       "4      74.0        N            2   2019/11/6     0:05:22  \n",
       "..      ...      ...          ...         ...         ...  \n",
       "195    46.0        N            2  2019/10/17     0:04:31  \n",
       "196    50.0        N            3   2019/9/22     0:04:03  \n",
       "197    45.0        N            1    2020/1/5     0:04:48  \n",
       "198    71.0        N            2    2020/1/7     0:04:58  \n",
       "199    51.0        N            1   2019/11/6     0:05:05  \n",
       "\n",
       "[200 rows x 10 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv('D:/week04/data/learn_pandas.csv')\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6a2ae51b",
   "metadata": {},
   "source": [
    "* 计算所有身高的平均值，最大值，最小值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "2e19cbfb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "163.21803278688526"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Height'].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "24332c60",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "193.9"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Height'].max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "ea6aa739",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "145.4"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Height'].min()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "c1d26192",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [School, Grade, Name, Gender, Height, Weight, Transfer, Test_Number, Test_Date, Time_Record]\n",
       "Index: []"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "97374384",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "de63d040",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "307c620c",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "3b02ec14",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>158.9</td>\n",
       "      <td>46.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>166.5</td>\n",
       "      <td>70.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>188.9</td>\n",
       "      <td>89.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>NaN</td>\n",
       "      <td>41.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>174.0</td>\n",
       "      <td>74.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>195</th>\n",
       "      <td>153.9</td>\n",
       "      <td>46.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>160.9</td>\n",
       "      <td>50.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>153.9</td>\n",
       "      <td>45.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>175.3</td>\n",
       "      <td>71.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>155.7</td>\n",
       "      <td>51.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>200 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     Height  Weight\n",
       "0     158.9    46.0\n",
       "1     166.5    70.0\n",
       "2     188.9    89.0\n",
       "3       NaN    41.0\n",
       "4     174.0    74.0\n",
       "..      ...     ...\n",
       "195   153.9    46.0\n",
       "196   160.9    50.0\n",
       "197   153.9    45.0\n",
       "198   175.3    71.0\n",
       "199   155.7    51.0\n",
       "\n",
       "[200 rows x 2 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_demo = df[['Height','Weight']]\n",
    "df_demo"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "9591a0d4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<bound method Series.unique of 0      Shanghai Jiao Tong University\n",
       "1                  Peking University\n",
       "2      Shanghai Jiao Tong University\n",
       "3                   Fudan University\n",
       "4                   Fudan University\n",
       "                   ...              \n",
       "195                 Fudan University\n",
       "196              Tsinghua University\n",
       "197    Shanghai Jiao Tong University\n",
       "198    Shanghai Jiao Tong University\n",
       "199              Tsinghua University\n",
       "Name: School, Length: 200, dtype: object>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['School'].unique"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "1255eaa7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<bound method Series.unique of 0        Gaopeng Yang\n",
       "1      Changqiang You\n",
       "2             Mei Sun\n",
       "3        Xiaojuan Sun\n",
       "4         Gaojuan You\n",
       "            ...      \n",
       "195      Xiaojuan Sun\n",
       "196           Li Zhao\n",
       "197    Chengqiang Chu\n",
       "198     Chengmei Shen\n",
       "199       Chunpeng Lv\n",
       "Name: Name, Length: 200, dtype: object>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Name'].unique"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "9231f816",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Tsinghua University              69\n",
       "Shanghai Jiao Tong University    57\n",
       "Fudan University                 40\n",
       "Peking University                34\n",
       "Name: School, dtype: int64"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['School'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "74a97ece",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaopeng Yang</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/5</td>\n",
       "      <td>0:04:34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changqiang You</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.5</td>\n",
       "      <td>70.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/4</td>\n",
       "      <td>0:04:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Sun</td>\n",
       "      <td>Male</td>\n",
       "      <td>188.9</td>\n",
       "      <td>89.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/12</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>41.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/3</td>\n",
       "      <td>0:04:08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Gaojuan You</td>\n",
       "      <td>Male</td>\n",
       "      <td>174.0</td>\n",
       "      <td>74.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>195</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/17</td>\n",
       "      <td>0:04:31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Li Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.9</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/22</td>\n",
       "      <td>0:04:03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengqiang Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>45.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/5</td>\n",
       "      <td>0:04:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengmei Shen</td>\n",
       "      <td>Male</td>\n",
       "      <td>175.3</td>\n",
       "      <td>71.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/7</td>\n",
       "      <td>0:04:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Chunpeng Lv</td>\n",
       "      <td>Male</td>\n",
       "      <td>155.7</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:05</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>200 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                            School      Grade            Name  Gender  Height  \\\n",
       "0    Shanghai Jiao Tong University   Freshman    Gaopeng Yang  Female   158.9   \n",
       "1                Peking University   Freshman  Changqiang You    Male   166.5   \n",
       "2    Shanghai Jiao Tong University     Senior         Mei Sun    Male   188.9   \n",
       "3                 Fudan University  Sophomore    Xiaojuan Sun  Female     NaN   \n",
       "4                 Fudan University  Sophomore     Gaojuan You    Male   174.0   \n",
       "..                             ...        ...             ...     ...     ...   \n",
       "195               Fudan University     Junior    Xiaojuan Sun  Female   153.9   \n",
       "196            Tsinghua University     Senior         Li Zhao  Female   160.9   \n",
       "197  Shanghai Jiao Tong University     Senior  Chengqiang Chu  Female   153.9   \n",
       "198  Shanghai Jiao Tong University     Senior   Chengmei Shen    Male   175.3   \n",
       "199            Tsinghua University  Sophomore     Chunpeng Lv    Male   155.7   \n",
       "\n",
       "     Weight Transfer  Test_Number   Test_Date Time_Record  \n",
       "0      46.0        N            1   2019/10/5     0:04:34  \n",
       "1      70.0        N            1    2019/9/4     0:04:20  \n",
       "2      89.0        N            2   2019/9/12     0:05:22  \n",
       "3      41.0        N            2    2020/1/3     0:04:08  \n",
       "4      74.0        N            2   2019/11/6     0:05:22  \n",
       "..      ...      ...          ...         ...         ...  \n",
       "195    46.0        N            2  2019/10/17     0:04:31  \n",
       "196    50.0        N            3   2019/9/22     0:04:03  \n",
       "197    45.0        N            1    2020/1/5     0:04:48  \n",
       "198    71.0        N            2    2020/1/7     0:04:58  \n",
       "199    51.0        N            1   2019/11/6     0:05:05  \n",
       "\n",
       "[200 rows x 10 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bdd92fcd",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fa49da22",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "e43bfd36",
   "metadata": {},
   "source": [
    "* 所有不同学校的身高均值。。。。。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "2548e423",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changqiang You</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.5</td>\n",
       "      <td>70.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/4</td>\n",
       "      <td>0:04:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Juan Xu</td>\n",
       "      <td>Female</td>\n",
       "      <td>164.8</td>\n",
       "      <td>NaN</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/10/5</td>\n",
       "      <td>0:04:05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Changjuan You</td>\n",
       "      <td>Female</td>\n",
       "      <td>161.4</td>\n",
       "      <td>47.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/5</td>\n",
       "      <td>0:04:08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Changmei Xu</td>\n",
       "      <td>Female</td>\n",
       "      <td>151.6</td>\n",
       "      <td>43.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/3</td>\n",
       "      <td>0:04:28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Changli Lv</td>\n",
       "      <td>Female</td>\n",
       "      <td>148.7</td>\n",
       "      <td>41.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/13</td>\n",
       "      <td>0:04:54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaopeng Shi</td>\n",
       "      <td>Female</td>\n",
       "      <td>162.9</td>\n",
       "      <td>48.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/12</td>\n",
       "      <td>0:04:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaoli Zhao</td>\n",
       "      <td>Male</td>\n",
       "      <td>175.4</td>\n",
       "      <td>78.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/8</td>\n",
       "      <td>0:03:32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Xiaojuan Qin</td>\n",
       "      <td>Male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>79.0</td>\n",
       "      <td>Y</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/10</td>\n",
       "      <td>0:04:10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Qiang Han</td>\n",
       "      <td>Male</td>\n",
       "      <td>185.3</td>\n",
       "      <td>87.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2020/1/7</td>\n",
       "      <td>0:03:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Quan Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>154.7</td>\n",
       "      <td>43.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/28</td>\n",
       "      <td>0:04:47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Xiaojuan Chu</td>\n",
       "      <td>Male</td>\n",
       "      <td>162.4</td>\n",
       "      <td>58.0</td>\n",
       "      <td>Y</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/11/29</td>\n",
       "      <td>0:03:42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>57</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changquan Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>159.6</td>\n",
       "      <td>45.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/12/9</td>\n",
       "      <td>0:04:18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Gaoli Xu</td>\n",
       "      <td>Female</td>\n",
       "      <td>157.3</td>\n",
       "      <td>48.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/12/11</td>\n",
       "      <td>0:05:13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>61</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaopeng Qin</td>\n",
       "      <td>Male</td>\n",
       "      <td>172.8</td>\n",
       "      <td>NaN</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/23</td>\n",
       "      <td>0:05:29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>72</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Gaoquan Zhou</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.8</td>\n",
       "      <td>70.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/5</td>\n",
       "      <td>0:04:24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Qiang You</td>\n",
       "      <td>Female</td>\n",
       "      <td>170.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/12/31</td>\n",
       "      <td>0:04:27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>83</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Mei Xu</td>\n",
       "      <td>Female</td>\n",
       "      <td>154.2</td>\n",
       "      <td>39.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/5</td>\n",
       "      <td>0:04:29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Feng Zheng</td>\n",
       "      <td>Female</td>\n",
       "      <td>162.6</td>\n",
       "      <td>49.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/5</td>\n",
       "      <td>0:04:11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>88</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Xiaopeng Han</td>\n",
       "      <td>Female</td>\n",
       "      <td>164.1</td>\n",
       "      <td>53.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/18</td>\n",
       "      <td>0:05:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changmei Feng</td>\n",
       "      <td>Female</td>\n",
       "      <td>163.8</td>\n",
       "      <td>56.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/11/8</td>\n",
       "      <td>0:04:41</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changpeng Zhao</td>\n",
       "      <td>Male</td>\n",
       "      <td>181.3</td>\n",
       "      <td>83.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/24</td>\n",
       "      <td>0:04:08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaoli Zhou</td>\n",
       "      <td>Female</td>\n",
       "      <td>166.8</td>\n",
       "      <td>55.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/28</td>\n",
       "      <td>0:05:24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>102</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Chengli Zhao</td>\n",
       "      <td>Male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/13</td>\n",
       "      <td>0:03:55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>116</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Feng Zhao</td>\n",
       "      <td>Male</td>\n",
       "      <td>167.2</td>\n",
       "      <td>66.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/3</td>\n",
       "      <td>0:04:56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>120</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Peng Han</td>\n",
       "      <td>Female</td>\n",
       "      <td>147.8</td>\n",
       "      <td>34.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/19</td>\n",
       "      <td>0:03:32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>127</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Changquan Han</td>\n",
       "      <td>Male</td>\n",
       "      <td>173.4</td>\n",
       "      <td>77.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/4</td>\n",
       "      <td>0:03:56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>130</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Feng</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/28</td>\n",
       "      <td>0:05:29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>132</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chunpeng Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>161.6</td>\n",
       "      <td>NaN</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/10</td>\n",
       "      <td>0:04:10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>140</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Qiang Zhang</td>\n",
       "      <td>Female</td>\n",
       "      <td>152.7</td>\n",
       "      <td>43.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/30</td>\n",
       "      <td>0:05:27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>147</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Juan You</td>\n",
       "      <td>Male</td>\n",
       "      <td>169.2</td>\n",
       "      <td>69.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/31</td>\n",
       "      <td>0:05:28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>159</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Chengpeng Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>156.0</td>\n",
       "      <td>44.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/2</td>\n",
       "      <td>0:03:53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>183</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaofeng Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>159.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/17</td>\n",
       "      <td>0:05:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>185</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Chunmei Wang</td>\n",
       "      <td>Female</td>\n",
       "      <td>151.2</td>\n",
       "      <td>43.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/12/10</td>\n",
       "      <td>0:04:24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>194</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Yanmei Qian</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.3</td>\n",
       "      <td>49.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/12/3</td>\n",
       "      <td>0:05:08</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                School      Grade            Name  Gender  Height  Weight  \\\n",
       "1    Peking University   Freshman  Changqiang You    Male   166.5    70.0   \n",
       "9    Peking University     Junior         Juan Xu  Female   164.8     NaN   \n",
       "20   Peking University     Junior   Changjuan You  Female   161.4    47.0   \n",
       "29   Peking University  Sophomore     Changmei Xu  Female   151.6    43.0   \n",
       "30   Peking University     Senior      Changli Lv  Female   148.7    41.0   \n",
       "32   Peking University   Freshman     Gaopeng Shi  Female   162.9    48.0   \n",
       "35   Peking University   Freshman      Gaoli Zhao    Male   175.4    78.0   \n",
       "36   Peking University   Freshman    Xiaojuan Qin    Male     NaN    79.0   \n",
       "38   Peking University   Freshman       Qiang Han    Male   185.3    87.0   \n",
       "45   Peking University   Freshman        Quan Chu  Female   154.7    43.0   \n",
       "54   Peking University   Freshman    Xiaojuan Chu    Male   162.4    58.0   \n",
       "57   Peking University   Freshman   Changquan Chu  Female   159.6    45.0   \n",
       "59   Peking University     Junior        Gaoli Xu  Female   157.3    48.0   \n",
       "61   Peking University  Sophomore    Xiaopeng Qin    Male   172.8     NaN   \n",
       "72   Peking University     Junior    Gaoquan Zhou    Male   166.8    70.0   \n",
       "75   Peking University     Junior       Qiang You  Female   170.0    56.0   \n",
       "83   Peking University  Sophomore          Mei Xu  Female   154.2    39.0   \n",
       "86   Peking University     Senior      Feng Zheng  Female   162.6    49.0   \n",
       "88   Peking University   Freshman    Xiaopeng Han  Female   164.1    53.0   \n",
       "96   Peking University   Freshman   Changmei Feng  Female   163.8    56.0   \n",
       "99   Peking University   Freshman  Changpeng Zhao    Male   181.3    83.0   \n",
       "101  Peking University  Sophomore     Xiaoli Zhou  Female   166.8    55.0   \n",
       "102  Peking University     Junior    Chengli Zhao    Male     NaN     NaN   \n",
       "116  Peking University     Senior       Feng Zhao    Male   167.2    66.0   \n",
       "120  Peking University  Sophomore        Peng Han  Female   147.8    34.0   \n",
       "127  Peking University     Senior   Changquan Han    Male   173.4    77.0   \n",
       "130  Peking University     Senior        Mei Feng  Female     NaN    51.0   \n",
       "132  Peking University     Senior   Chunpeng Qian  Female   161.6     NaN   \n",
       "140  Peking University   Freshman     Qiang Zhang  Female   152.7    43.0   \n",
       "147  Peking University     Senior        Juan You    Male   169.2    69.0   \n",
       "159  Peking University     Junior  Chengpeng Zhao  Female   156.0    44.0   \n",
       "183  Peking University     Junior   Xiaofeng Zhao  Female   159.9    46.0   \n",
       "185  Peking University   Freshman    Chunmei Wang  Female   151.2    43.0   \n",
       "194  Peking University     Senior     Yanmei Qian  Female   160.3    49.0   \n",
       "\n",
       "    Transfer  Test_Number   Test_Date Time_Record  \n",
       "1          N            1    2019/9/4     0:04:20  \n",
       "9          N            3   2019/10/5     0:04:05  \n",
       "20         N            1   2019/10/5     0:04:08  \n",
       "29         N            2    2020/1/3     0:04:28  \n",
       "30         N            2  2019/11/13     0:04:54  \n",
       "32         N            1   2019/9/12     0:04:58  \n",
       "35         N            2   2019/10/8     0:03:32  \n",
       "36         Y            1  2019/12/10     0:04:10  \n",
       "38         N            3    2020/1/7     0:03:58  \n",
       "45         N            1  2019/11/28     0:04:47  \n",
       "54         Y            3  2019/11/29     0:03:42  \n",
       "57         N            2   2019/12/9     0:04:18  \n",
       "59         N            2  2019/12/11     0:05:13  \n",
       "61         N            1  2019/12/23     0:05:29  \n",
       "72         N            2    2019/9/5     0:04:24  \n",
       "75         N            3  2019/12/31     0:04:27  \n",
       "83         N            2   2019/11/5     0:04:29  \n",
       "86         N            2   2019/11/5     0:04:11  \n",
       "88         N            1  2019/12/18     0:05:20  \n",
       "96         N            3   2019/11/8     0:04:41  \n",
       "99         N            2  2019/10/24     0:04:08  \n",
       "101        N            1  2019/10/28     0:05:24  \n",
       "102      NaN            1  2019/10/13     0:03:55  \n",
       "116        N            1    2020/1/3     0:04:56  \n",
       "120      NaN            2   2019/9/19     0:03:32  \n",
       "127        N            1   2019/11/4     0:03:56  \n",
       "130        N            3   2019/9/28     0:05:29  \n",
       "132        N            1  2019/11/10     0:04:10  \n",
       "140        N            1  2019/11/30     0:05:27  \n",
       "147      NaN            1  2019/10/31     0:05:28  \n",
       "159        N            1    2019/9/2     0:03:53  \n",
       "183        N            1  2019/10/17     0:05:20  \n",
       "185        N            2  2019/12/10     0:04:24  \n",
       "194      NaN            1   2019/12/3     0:05:08  "
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.query(\" School ==  'Peking University'\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "68796ea7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Height         162.977419\n",
       "Weight          55.666667\n",
       "Test_Number      1.676471\n",
       "dtype: float64"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.query(\" School ==  'Peking University'\").mean()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a2d1f192",
   "metadata": {},
   "source": [
    "## 3.1 Groupby"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "edcf0ecd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Height</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>School</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Fudan University</th>\n",
       "      <td>162.408824</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Peking University</th>\n",
       "      <td>162.977419</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Shanghai Jiao Tong University</th>\n",
       "      <td>163.932727</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Tsinghua University</th>\n",
       "      <td>163.149206</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                   Height\n",
       "School                                   \n",
       "Fudan University               162.408824\n",
       "Peking University              162.977419\n",
       "Shanghai Jiao Tong University  163.932727\n",
       "Tsinghua University            163.149206"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.groupby('School').agg({'Height':'mean'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "9efd0362",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>School</th>\n",
       "      <th>Gender</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Fudan University</th>\n",
       "      <th>Female</th>\n",
       "      <td>158.776923</td>\n",
       "      <td>47.900000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Male</th>\n",
       "      <td>174.212500</td>\n",
       "      <td>72.300000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Peking University</th>\n",
       "      <th>Female</th>\n",
       "      <td>158.666667</td>\n",
       "      <td>46.650000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Male</th>\n",
       "      <td>172.030000</td>\n",
       "      <td>73.700000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Shanghai Jiao Tong University</th>\n",
       "      <th>Female</th>\n",
       "      <td>159.122500</td>\n",
       "      <td>48.513514</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Male</th>\n",
       "      <td>176.760000</td>\n",
       "      <td>76.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Tsinghua University</th>\n",
       "      <th>Female</th>\n",
       "      <td>159.753333</td>\n",
       "      <td>48.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Male</th>\n",
       "      <td>171.638889</td>\n",
       "      <td>69.947368</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                          Height     Weight\n",
       "School                        Gender                       \n",
       "Fudan University              Female  158.776923  47.900000\n",
       "                              Male    174.212500  72.300000\n",
       "Peking University             Female  158.666667  46.650000\n",
       "                              Male    172.030000  73.700000\n",
       "Shanghai Jiao Tong University Female  159.122500  48.513514\n",
       "                              Male    176.760000  76.000000\n",
       "Tsinghua University           Female  159.753333  48.000000\n",
       "                              Male    171.638889  69.947368"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.groupby(['School','Gender']).agg({'Height':'mean','Weight':'mean'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "581a8831",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>排名</td>\n",
       "      <td>排名变化</td>\n",
       "      <td>企业名称</td>\n",
       "      <td>价值（亿元人民币）</td>\n",
       "      <td>价值变化（亿元人民币）</td>\n",
       "      <td>国家</td>\n",
       "      <td>城市</td>\n",
       "      <td>行业</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>抖音</td>\n",
       "      <td>13400</td>\n",
       "      <td>-10050</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>社交媒体</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>SpaceX</td>\n",
       "      <td>8400</td>\n",
       "      <td>1680</td>\n",
       "      <td>美国</td>\n",
       "      <td>洛杉矶</td>\n",
       "      <td>航天</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>-1</td>\n",
       "      <td>蚂蚁集团</td>\n",
       "      <td>8000</td>\n",
       "      <td>-2010</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>Stripe</td>\n",
       "      <td>4100</td>\n",
       "      <td>-2210</td>\n",
       "      <td>美国</td>\n",
       "      <td>旧金山</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>Impossible 食品</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>美国</td>\n",
       "      <td>雷德伍德城</td>\n",
       "      <td>食品饮料</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>微医</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>健康科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99</td>\n",
       "      <td>58</td>\n",
       "      <td>蜂巢能源</td>\n",
       "      <td>460</td>\n",
       "      <td>190</td>\n",
       "      <td>中国</td>\n",
       "      <td>常州</td>\n",
       "      <td>新能源</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>99</td>\n",
       "      <td>-6</td>\n",
       "      <td>Better.com</td>\n",
       "      <td>460</td>\n",
       "      <td>60</td>\n",
       "      <td>美国</td>\n",
       "      <td>纽约</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101</th>\n",
       "      <td>99</td>\n",
       "      <td>-20</td>\n",
       "      <td>Automation Anywhere</td>\n",
       "      <td>460</td>\n",
       "      <td>-10</td>\n",
       "      <td>美国</td>\n",
       "      <td>圣何塞</td>\n",
       "      <td>人工智能</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>102 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      0     1                    2          3            4   5      6     7\n",
       "0    排名  排名变化                 企业名称  价值（亿元人民币）  价值变化（亿元人民币）  国家     城市    行业\n",
       "1     1     0                   抖音      13400       -10050  中国     北京  社交媒体\n",
       "2     2     1               SpaceX       8400         1680  美国    洛杉矶    航天\n",
       "3     3    -1                 蚂蚁集团       8000        -2010  中国     杭州  金融科技\n",
       "4     4     0               Stripe       4100        -2210  美国    旧金山  金融科技\n",
       "..   ..   ...                  ...        ...          ...  ..    ...   ...\n",
       "97   95   -16        Impossible 食品        470            0  美国  雷德伍德城  食品饮料\n",
       "98   95   -16                   微医        470            0  中国     杭州  健康科技\n",
       "99   99    58                 蜂巢能源        460          190  中国     常州   新能源\n",
       "100  99    -6           Better.com        460           60  美国     纽约  金融科技\n",
       "101  99   -20  Automation Anywhere        460          -10  美国    圣何塞  人工智能\n",
       "\n",
       "[102 rows x 8 columns]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "hurun_独角兽 = pd.read_html('https://www.hurun.net/zh-CN/Info/Detail?num=L9SQPH9FKJB1')[-3]\n",
    "hurun_独角兽"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "070006a9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['排名', '排名变化', '企业名称', '价值（亿元人民币）', '价值变化（亿元人民币）', '国家', '城市', '行业']"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hurun_独角兽[0:1].values.tolist()[0]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1ebf93f5",
   "metadata": {},
   "source": [
    "* columns的重新命名：rename"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "a82ea5de",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>抖音</td>\n",
       "      <td>13400</td>\n",
       "      <td>-10050</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>社交媒体</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>SpaceX</td>\n",
       "      <td>8400</td>\n",
       "      <td>1680</td>\n",
       "      <td>美国</td>\n",
       "      <td>洛杉矶</td>\n",
       "      <td>航天</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>-1</td>\n",
       "      <td>蚂蚁集团</td>\n",
       "      <td>8000</td>\n",
       "      <td>-2010</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>Stripe</td>\n",
       "      <td>4100</td>\n",
       "      <td>-2210</td>\n",
       "      <td>美国</td>\n",
       "      <td>旧金山</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5</td>\n",
       "      <td>11</td>\n",
       "      <td>Shein</td>\n",
       "      <td>4000</td>\n",
       "      <td>2680</td>\n",
       "      <td>中国</td>\n",
       "      <td>广州</td>\n",
       "      <td>电子商务</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>Impossible 食品</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>美国</td>\n",
       "      <td>雷德伍德城</td>\n",
       "      <td>食品饮料</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>微医</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>健康科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99</td>\n",
       "      <td>58</td>\n",
       "      <td>蜂巢能源</td>\n",
       "      <td>460</td>\n",
       "      <td>190</td>\n",
       "      <td>中国</td>\n",
       "      <td>常州</td>\n",
       "      <td>新能源</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>99</td>\n",
       "      <td>-6</td>\n",
       "      <td>Better.com</td>\n",
       "      <td>460</td>\n",
       "      <td>60</td>\n",
       "      <td>美国</td>\n",
       "      <td>纽约</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101</th>\n",
       "      <td>99</td>\n",
       "      <td>-20</td>\n",
       "      <td>Automation Anywhere</td>\n",
       "      <td>460</td>\n",
       "      <td>-10</td>\n",
       "      <td>美国</td>\n",
       "      <td>圣何塞</td>\n",
       "      <td>人工智能</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>101 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      0    1                    2      3       4   5      6     7\n",
       "1     1    0                   抖音  13400  -10050  中国     北京  社交媒体\n",
       "2     2    1               SpaceX   8400    1680  美国    洛杉矶    航天\n",
       "3     3   -1                 蚂蚁集团   8000   -2010  中国     杭州  金融科技\n",
       "4     4    0               Stripe   4100   -2210  美国    旧金山  金融科技\n",
       "5     5   11                Shein   4000    2680  中国     广州  电子商务\n",
       "..   ..  ...                  ...    ...     ...  ..    ...   ...\n",
       "97   95  -16        Impossible 食品    470       0  美国  雷德伍德城  食品饮料\n",
       "98   95  -16                   微医    470       0  中国     杭州  健康科技\n",
       "99   99   58                 蜂巢能源    460     190  中国     常州   新能源\n",
       "100  99   -6           Better.com    460      60  美国     纽约  金融科技\n",
       "101  99  -20  Automation Anywhere    460     -10  美国    圣何塞  人工智能\n",
       "\n",
       "[101 rows x 8 columns]"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun = hurun_独角兽[1:]\n",
    "df_hurun"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "f2ab7449",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>排名变化</th>\n",
       "      <th>企业名称</th>\n",
       "      <th>价值（亿元人民币）</th>\n",
       "      <th>价值变化（亿元人民币）</th>\n",
       "      <th>国家</th>\n",
       "      <th>城市</th>\n",
       "      <th>行业</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>抖音</td>\n",
       "      <td>13400</td>\n",
       "      <td>-10050</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>社交媒体</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>SpaceX</td>\n",
       "      <td>8400</td>\n",
       "      <td>1680</td>\n",
       "      <td>美国</td>\n",
       "      <td>洛杉矶</td>\n",
       "      <td>航天</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>-1</td>\n",
       "      <td>蚂蚁集团</td>\n",
       "      <td>8000</td>\n",
       "      <td>-2010</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>Stripe</td>\n",
       "      <td>4100</td>\n",
       "      <td>-2210</td>\n",
       "      <td>美国</td>\n",
       "      <td>旧金山</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5</td>\n",
       "      <td>11</td>\n",
       "      <td>Shein</td>\n",
       "      <td>4000</td>\n",
       "      <td>2680</td>\n",
       "      <td>中国</td>\n",
       "      <td>广州</td>\n",
       "      <td>电子商务</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>Impossible 食品</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>美国</td>\n",
       "      <td>雷德伍德城</td>\n",
       "      <td>食品饮料</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>微医</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>健康科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99</td>\n",
       "      <td>58</td>\n",
       "      <td>蜂巢能源</td>\n",
       "      <td>460</td>\n",
       "      <td>190</td>\n",
       "      <td>中国</td>\n",
       "      <td>常州</td>\n",
       "      <td>新能源</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>99</td>\n",
       "      <td>-6</td>\n",
       "      <td>Better.com</td>\n",
       "      <td>460</td>\n",
       "      <td>60</td>\n",
       "      <td>美国</td>\n",
       "      <td>纽约</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101</th>\n",
       "      <td>99</td>\n",
       "      <td>-20</td>\n",
       "      <td>Automation Anywhere</td>\n",
       "      <td>460</td>\n",
       "      <td>-10</td>\n",
       "      <td>美国</td>\n",
       "      <td>圣何塞</td>\n",
       "      <td>人工智能</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>101 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     排名 排名变化                 企业名称 价值（亿元人民币） 价值变化（亿元人民币）  国家     城市    行业\n",
       "1     1    0                   抖音     13400      -10050  中国     北京  社交媒体\n",
       "2     2    1               SpaceX      8400        1680  美国    洛杉矶    航天\n",
       "3     3   -1                 蚂蚁集团      8000       -2010  中国     杭州  金融科技\n",
       "4     4    0               Stripe      4100       -2210  美国    旧金山  金融科技\n",
       "5     5   11                Shein      4000        2680  中国     广州  电子商务\n",
       "..   ..  ...                  ...       ...         ...  ..    ...   ...\n",
       "97   95  -16        Impossible 食品       470           0  美国  雷德伍德城  食品饮料\n",
       "98   95  -16                   微医       470           0  中国     杭州  健康科技\n",
       "99   99   58                 蜂巢能源       460         190  中国     常州   新能源\n",
       "100  99   -6           Better.com       460          60  美国     纽约  金融科技\n",
       "101  99  -20  Automation Anywhere       460         -10  美国    圣何塞  人工智能\n",
       "\n",
       "[101 rows x 8 columns]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun.columns = hurun_独角兽[0:1].values.tolist()[0]\n",
    "df_hurun"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "1e2f43b6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['中国', '美国', '马耳他', '英国', '澳大利亚', '印度', '瑞典', '印度尼西亚', '巴哈马', '土耳其',\n",
       "       '墨西哥', '瑞士', '韩国', '德国', '越南', '以色列'], dtype=object)"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun['国家'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "e5808fe3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['社交媒体', '航天', '金融科技', '电子商务', '区块链', '大数据', '数字科技', '物流', '软件服务',\n",
       "       '教育科技', '新能源汽车', '快递', '机器人', '企业服务', '健康科技', '共享经济', '食品饮料',\n",
       "       '人工智能', '生物科技', '新能源', '保险', '新零售', '游戏', '网络安全', '分析', '消费品'],\n",
       "      dtype=object)"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun['行业'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "d8091797",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "美国       49\n",
       "中国       26\n",
       "英国        7\n",
       "印度        4\n",
       "韩国        2\n",
       "印度尼西亚     2\n",
       "瑞典        2\n",
       "巴哈马       1\n",
       "墨西哥       1\n",
       "马耳他       1\n",
       "瑞士        1\n",
       "澳大利亚      1\n",
       "德国        1\n",
       "越南        1\n",
       "以色列       1\n",
       "土耳其       1\n",
       "Name: 国家, dtype: int64"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun['国家'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "7bc3812c",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (<ipython-input-49-dbb9481dfa7d>, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-49-dbb9481dfa7d>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m    df_hurun.['价值（亿元人民币）'] = df_hurun.['价值（亿元人民币）'].astype('int64')\u001b[0m\n\u001b[1;37m             ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "df_hurun.['价值（亿元人民币）'] = df_hurun.['价值（亿元人民币）'].astype('int64')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9cb1f226",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
